import axios from 'axios'
import config from '@base/constant/config'

const serve = axios.create({
  baseURL: config.baseURL,
  timeout: config.timeout
})

serve.interceptors.request.use(
  config => {
      return config
  },
  error => {
      Promise.reject(error)
  }
)

serve.interceptors.response.use(
  response => {
      const res = response.data
      return res
  },
  error => {
      return Promise.reject(error)
  }
)

export default serve